﻿function showChart0() {
    jzcode.event.sendEvent('showChart0', null);
}
function hideChart0() {
    jzcode.event.sendEvent('hideChart0', null);
}
function zoomInHBRL() {
    jzcode.event.sendEvent('zoomInHBRL', null);
}
function zoomOutHBRL() {
    jzcode.event.sendEvent('zoomOutHBRL', null);
}
function zoomInGNELLC() {
    jzcode.event.sendEvent('zoomInGNELLC', null);
}
function zoomOutGNELLC() {
    jzcode.event.sendEvent('zoomOutGNELLC', null);
}
function register() {
    jzcode.event.registerEvent('showChart0', function () {
        showChartWTSLD();
        s4_3.chart0.isVisible = true;
    });

    jzcode.event.registerEvent('hideChart0', function () {
        option.graphic = [{
            id: 'chart0',
            $action: 'remove'
        }];
        option.xAxis[0].data = null;
        s4_3.seriesChart0.data = null;
        myChart.setOption(option);
        s4_3.chart0.isVisible = false;
    });
    jzcode.event.registerEvent('zoomInHBRL', function () {
        return;
        s4_3.showStep();
        s4_3.seriesHBRL.left = 520;
        s4_3.seriesHBRL.top = 720;
        s4_3.seriesHBRL.right = 810;
        s4_3.seriesHBRL.bottom = 60;
        s4_3.seriesLink.data = s4_3.convertLinkData(g_s4_3gnwllcJson);
        s4_3.seriesHBRL.z = 5;
        option.graphic = {
            elements: [{
                id: 'title-hbrl',
                type: 'image',
                left: 529,
                top: 695,
                style: {
                    image: './images/s4-3/title-hbrl.png'
                },
                z: 3
            }, {
                id: 'map-popup-bg',
                $action: 'remove'
            }]
        };
        myChart.setOption(option, true, false);
    });
    jzcode.event.registerEvent('zoomOutHBRL', function () {
        return;
        //
        s4_3.hideStep();
        s4_3.seriesHBRL.left = 550;
        s4_3.seriesHBRL.top = 190;
        s4_3.seriesHBRL.right = 60;
        s4_3.seriesHBRL.bottom = 170;
        s4_3.seriesHBRL.z = 35;

        s4_3.seriesLink.data = null;
        option.graphic = {
            elements: [{
                id: 'title-hbrl',
                $action: 'remove'
            }, {
                id: 'map-popup-bg',
                type: 'image',
                left: 502,
                top: 157,
                style: {
                    image: './images/s4-3/map-popup-bg.png'
                },
                z: 33
            }]
        };
        myChart.setOption(option);
    });
    jzcode.event.registerEvent('zoomInGNELLC', function () {
        s4_3.seriesGNELLC.z = 3;
        s4_3.seriesGNELLC.left = 1290;
        s4_3.seriesGNELLC.top = 700;
        s4_3.seriesGNELLC.right = 150;
        s4_3.seriesGNELLC.bottom = 60;
        s4_3.seriesGNELLC.itemStyle = {
            normal: {
                areaColor: 'rgba(255, 255, 255, 0)',
                borderColor: '#fff',
                borderWidth: 1
            }
        };

        s4_3.seriesLink.effect = {
            show: true,
            period: 6,
            trailLength: 0,
            symbol: 'circle',
            symbolSize: 3,
            color: '#fff'
        };
        s4_3.seriesLink.lineStyle = {
            normal: {
                color: '#ff0',
                width: 2,
                opacity: 0.6,
                curveness: 0.2
            }
        };
        s4_3.seriesLinkCity.label = {
            normal: {
                show: false,
                formatter: '{b}',
                textStyle: {
                    color: '#fff',
                    fontWeight: 'bold',
                    fontSize: 12
                }
            }
        };
        s4_3.seriesLinkCity.symbolSize = function (val) {
            var lSize = val[2] / 110000;
            if (lSize < 3) {
                lSize = 3;
            }
            return lSize;
        };
        option.geo[1].left = 1290;
        option.geo[1].top = 700;
        option.geo[1].right = 150;
        option.geo[1].bottom = 60;
        option.graphic = {
            elements: [{
                id: 'map-popup-bg',
                $action: 'remove'
            }, {
                id: 'title-gnwllc',
                type: 'image',
                left: 1238,
                top: 695,
                style: {
                    image: './images/s4-4/s4-4-linktitle.png'
                },
                z: 3,
                $action: 'replace'
            }]
        };
        myChart.setOption(option);
    });
    jzcode.event.registerEvent('zoomOutGNELLC', function () {
        s4_3.seriesGNELLC.left = 600;
        s4_3.seriesGNELLC.top = 140;
        s4_3.seriesGNELLC.right = 140;
        s4_3.seriesGNELLC.bottom = 190;
        s4_3.seriesGNELLC.itemStyle = {
            normal: {
                areaColor: 'rgba(255, 255, 255, 0)',
                borderColor: '#fff',
                borderWidth: 3
            }
        };
        s4_3.seriesGNELLC.z = 135;

        s4_3.seriesLink.effect = {
            show: true,
            period: 6,
            trailLength: 0,
            symbol: 'circle',
            symbolSize: 4,
            color: '#fff'
        };
        s4_3.seriesLink.lineStyle = {
            normal: {
                color: '#ff0',
                width: 3,
                opacity: 0.6,
                curveness: 0.2
            }
        };
        
        s4_3.seriesLink.z = 136;
        s4_3.seriesLinkCity.z = 137;

        s4_3.seriesLinkCity.symbolSize = 8;
        s4_3.seriesLinkCity.label = {
            normal: {
                show: false,
                formatter: '{b}',
                textStyle: {
                    color: '#f00',
                    fontSize: 18
                }
            }
        };
        s4_3.seriesLinkCity.symbolSize = function (val) {
            var lSize = val[2] / 60000;
            if (lSize < 4) {
                lSize = 4;
            }
            return lSize;
        };

        option.geo[1].left = 600;
        option.geo[1].top = 140;
        option.geo[1].right = 140;
        option.geo[1].bottom = 190;
        option.graphic = {
            elements: [{
                id: 'map-popup-bg',
                type: 'image',
                left: 502,
                top: 130,
                style: {
                    image: './images/s4-3/map-popup-bg.png'
                },
                z: 33
            }, {
                id: 'title-gnwllc',
                type: 'image',
                left: 530,
                top: 155,
                style: {
                    image: './images/s4-4/s4-4-linktitle.png'
                },
                z: 300,
                $action: 'replace'
            }]
        };
        myChart.setOption(option);
    });
}


function showChartWTSLD() {
    
    $.get(jzcode.data.getUrl('./data/s4-3-chart0.json'), function (data) {
        option.xAxis[0].data = data.xValues;
        s4_3.seriesChart0.data = data.yValues;
        option.graphic = [{
            id: 'chart0',
            type: 'image',
            left: 1250,
            top: 671,
            style: {
                image: './images/s4-3/chart0.png'
            },
            z: 300
        }];
        myChart.setOption(option);
    }, 'json');

    //$.ajax({
    //    url: jzcode.data.getUrl('data/s4-3-chart0.json'),
    //    type: 'GET',
    //    dataType: 'json',
    //    timeout: 60000,
    //    cache: false,
    //    beforeSend: function () {
    //    }, //加载执行方法
    //    error: function () {
    //        buildChart(false);
    //    },  //错误执行方法
    //    success: function (result) {
    //        if (result.isSuccess) {
    //            //buildChart(true, '委托受理单数', result.data.xValues, result.data.yValues);

    //        } else {
    //            buildChart(false);
    //        }
    //    }//成功执行方法
    //});
}